@import './index.less';
@import './darkModePatch.less';

* {
  box-sizing: border-box;
  list-style: none;
  margin: 0;
  padding: 0;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
  border-radius: 3px;
}

::-webkit-scrollbar-track-piece {
  border: none;
  background-color: transparent;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
}

#html {
  body {
    width: 100% !important;
  }

  &.colorWeak {
    filter: invert(80%);
  }

  &.grayMode {
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    -o-filter: grayscale(100%);
    filter: grayscale(100%);
    filter: gray;
  }

  // 修复VITE_PLUGIN_THEME style生成的样式问题(viteThemePlugin)
  .ant-btn-primary {

    &:active,
    &:hover,
    &:focus {
      color: #FFF;
    }
  }
}

#app {
  height: 100%;

  &.userLayout {
    overflow: auto;
  }

  // 系统菜单颜色
  .SysMenu {

    // 统一设置
    .ant-menu-item-icon {
      width: 14px;
      height: 14px;
    }

    // 深色菜单
    &.ant-menu-dark {
      .ant-menu-item-icon {
        color: @dark-deactive-font-color !important;
      }

      .ant-menu-submenu-selected {
        .ant-menu-item-icon {
          color: #FFF !important;
        }
      }

      .ant-menu-item-active,
      .ant-menu-item-selected {
        .ant-menu-item-icon {
          color: #FFF !important;
        }
      }
    }

    // 浅色菜单,目前使用antv自动设置
    // &.ant-menu-light {
    //   .ant-menu-item-icon {
    //     color: #000 !important;
    //   }

    //   .ant-menu-submenu-active,
    //   .ant-menu-submenu-selected {
    //     .ant-menu-item-icon {
    //       color: @primary-color  !important;
    //     }
    //   }

    //   .ant-menu-item-active,
    //   .ant-menu-item-selected {
    //     .ant-menu-item-icon {
    //       color: @primary-color  !important;
    //     }
    //   }
    // }
  }
}

// 垂直菜单缩小样式(popupClassName),在id='app'之外
.popupSubMenu {
  .ant-menu-item {
    display: flex;
    flex-direction: row;
    align-items: center;

    .ant-menu-item-icon {
      width: 14px;
      height: 14px;
    }
  }

}

.ant-menu-inline-collapsed-tooltip {
  .ant-tooltip-inner {
    a {
      color: #FFF;
    }
  }
}

// 内容区域宽度为固定时的样式
.content-width-Fixed {
  & > main {
    width: 1200px;
    margin: 24px auto !important;
  }
}

.layout.ant-layout {
  height: auto;
  overflow-x: hidden;

  &.mobile,
  &.tablet {
    .ant-layout-content {
      .content {
        margin: 24px 0 0;
      }
    }

    /**
     * ant-table-wrapper
     * 覆盖的表格手机模式样式，如果想修改在手机上表格最低宽度，可以在这里改动
     */

    .ant-table-wrapper {
      .ant-table-content {
        overflow-y: auto;
      }

      .ant-table-body {
        min-width: 800px;
      }
    }

    .topmenu {

      /* 必须为 topmenu  才能启用流式布局 */

      &.content-width-Fluid {
        .header-index-wide {
          margin-left: 0;
        }
      }
    }
  }

  &.mobile {
    .sidemenu {
      .ant-header-fixedHeader {

        &.ant-header-side-opened,
        &.ant-header-side-closed {
          width: 100%;
        }
      }
    }
  }

  &.ant-layout-has-sider {
    flex-direction: row;
  }

  .trigger {
    font-size: 20px;
    line-height: 64px;
    padding: 0 24px;
    cursor: pointer;
    transition: color 0.3s;

    &:hover {
      background: rgba(0, 0, 0, 0.025);
    }
  }

  .topmenu {
    .ant-header-fixedHeader {
      position: fixed;
      top: 0;
      right: 0;
      z-index: 9;
      width: 100%;
      transition: width 0.2s;

      &.ant-header-side-opened {
        width: 100%;
      }

      &.ant-header-side-closed {
        width: 100%;
      }
    }

    /* 必须为 topmenu  才能启用流式布局 */

    &.content-width-Fluid {
      .header-index-wide {
        max-width: unset;

        .header-index-left {
          flex: 1 1 1000px;

          .logo {
            margin-left: 25px;
          }

          .ant-menu {
            justify-content: center;

            &.ant-menu-horizontal {
              max-width: calc(100vw - 190px - 285px - 25px);
              flex: 1 1 calc(100vw - 190px - 285px - 25px);
            }
          }
        }

        .header-index-right {
          margin-right: 25px;
        }
      }

      .page-header-index-wide {
        max-width: unset;
      }
    }
  }

  .sidemenu {
    .ant-header-fixedHeader {
      position: fixed;
      top: 0;
      right: 0;
      z-index: 9;
      width: 100%;
      transition: width 0.2s;

      &.ant-header-side-opened {
        width: calc(100% - 256px);
      }

      &.ant-header-side-closed {
        width: calc(100% - 80px);
      }
    }
  }

  .header {
    height: 64px;
    padding: 0 12px 0 0;
    background: #FFF;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    position: relative;
  }

  .header,
  .top-nav-header-index {
    .user-wrapper {
      float: right;
      height: 100%;

      .action {
        overflow: hidden;
        cursor: pointer;
        padding: 0 12px;
        display: inline-block;
        transition: all 0.3s;
        height: 100%;
        color: rgba(0, 0, 0, 0.65);

        &:hover {
          background: rgba(0, 0, 0, 0.025);
        }

        .avatar {
          margin: 20px 8px 20px 0;
          color: @primary-color;
          background: hsla(0, 0%, 100%, 0.85);
          vertical-align: middle;
        }

        .icon {
          font-size: 16px;
          padding: 4px;
        }
      }

      .anticon-question-circle,
      .ant-badge,
      .nickname {
        vertical-align: middle;
      }
    }

    &.dark {
      .user-wrapper {
        .action {
          color: rgba(255, 255, 255, 0.85);

          a {
            color: rgba(255, 255, 255, 0.85);
          }

          .ant-badge {
            color: rgba(255, 255, 255, 0.85);
          }

          &:hover {
            background: rgba(255, 255, 255, 0.16);
          }
        }
      }
    }
  }

  &.mobile,
  &.tablet {
    .top-nav-header-index {
      .header-index-wide {
        .header-index-left {
          .trigger {
            color: rgba(255, 255, 255, 0.85);
            padding: 0 12px;
          }

          .logo.top-nav-header {
            flex: 0 0 56px;
            text-align: center;
            line-height: 58px;

            h1 {
              display: none;
            }
          }
        }
      }

      &.light {
        .header-index-wide {
          .header-index-left {
            .trigger {
              color: rgba(0, 0, 0, 0.65);
            }
          }
        }

        //
      }
    }
  }

  &.tablet {

    // overflow: hidden; text-overflow:ellipsis; white-space: nowrap;
    .top-nav-header-index {
      .header-index-wide {
        .header-index-left {
          .logo > a {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }

        .ant-menu.ant-menu-horizontal {
          flex: 1 1 auto;
          white-space: normal;
        }
      }
    }
  }

  .top-nav-header-index {
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    position: relative;
    transition: background 0.3s, width 0.2s;

    .header-index-wide {
      max-width: 1200px;
      margin: auto;
      padding-left: 0;
      display: flex;
      height: 64px;

      .ant-menu.ant-menu-horizontal {
        max-width: 835px;
        flex: 0 1 835px;
        border: none;
        height: 64px;
        line-height: 64px;
      }

      .header-index-left {
        flex: 0 1 1000px;
        display: flex;

        .logo.top-nav-header {
          flex: 0 0 180px;
          width: 180px;
          height: 64px;
          position: relative;
          line-height: 64px;
          transition: all 0.3s;
          overflow: hidden;

          img,
          svg {
            display: inline-block;
            vertical-align: middle;
            height: 32px;
            width: 32px;
          }

          h1 {
            color: #FFF;
            display: inline-block;
            vertical-align: top;
            font-size: 16px;
            margin: 0 0 0 12px;
            font-weight: 400;
          }
        }
      }

      .header-index-right {
        flex: 0 0 285px;
        align-self: flex-end;
        height: 64px;
        overflow: hidden;

        .content-box {
          float: right;

          .action {
            max-width: 140px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }
      }
    }

    &.light {
      background-color: #FFF;

      .header-index-wide {
        .header-index-left {
          .logo {
            h1 {
              color: #002140;
            }
          }
        }
      }
    }
  }

  // 内容区
  .layout-content {
    margin: 24px 24px 0px;
    height: 100%;
    height: 64px;
    padding: 0 12px 0 0;
  }

  // footer
  .ant-layout-footer {
    padding: 0;
  }
}

.topmenu {
  .page-header-index-wide {
    max-width: 1200px;
    margin: 0 auto;
  }
}

.menu_active {
  color: @color-primary;
}

// drawer-sider 自定义
.ant-drawer.drawer-sider {
  .sider {
    box-shadow: none;
  }

  &.dark {
    .ant-drawer-content {
      background-color: rgb(0, 21, 41);
    }
  }

  &.light {
    box-shadow: none;

    .ant-drawer-content {
      background-color: #FFF;
    }
  }

  .ant-drawer-body {
    padding: 0;
  }
}

// 菜单样式
.sider {
  box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
  position: relative;
  z-index: @ant-global-sider-zindex;
  min-height: 100vh;

  .ant-layout-sider-children {
    overflow-y: hidden;

    &:hover {
      overflow-y: auto;
    }
  }

  &.ant-fixed-sidemenu {
    position: fixed;
    height: 100%;
  }

  .logo {
    position: relative;
    height: 64px;
    padding-left: 24px;
    overflow: hidden;
    line-height: 64px;
    background: #002140;
    transition: all .3s;

    img,
    svg,
    h1 {
      display: inline-block;
      vertical-align: middle;
    }

    img,
    svg {
      height: 32px;
      width: 32px;
    }

    h1 {
      color: #FFF;
      font-size: 20px;
      margin: 0 0 0 12px;
      font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
      font-weight: 600;
      vertical-align: middle;
    }
  }

  &.light {
    background-color: #FFF;
    box-shadow: 2px 0px 8px 0px rgba(29, 35, 41, 0.05);

    .logo {
      background: #FFF;
      box-shadow: 1px 1px 0px 0px #E8E8E8;

      h1 {
        color: unset;
      }
    }

    .ant-menu-light {
      border-right-color: transparent;
    }
  }
}

// 外置的样式控制
.user-dropdown-menu {
  span {
    user-select: none;
  }
}

.user-dropdown-menu-wrapper.ant-dropdown-menu {
  padding: 4px 0;

  .ant-dropdown-menu-item {
    width: 160px;
  }

  .ant-dropdown-menu-item > .anticon:first-child,
  .ant-dropdown-menu-item > .ant-dropdown-menu-title-content > a > .anticon:first-child,
  .ant-dropdown-menu-submenu-title > .anticon:first-child .ant-dropdown-menu-submenu-title > a > .anticon:first-child {
    min-width: 12px;
    margin-right: 8px;
  }
}

// 数据列表 样式
.table-alert {
  margin-bottom: 16px;
}

.table-page-search-wrapper {
  .ant-form-inline {
    .ant-form-item {
      display: flex;
      margin-bottom: 24px;
      margin-right: 0;

      .ant-form-item-control-wrapper {
        flex: 1 1;
        display: inline-block;
        vertical-align: middle;
      }

      > .ant-form-item-label {
        line-height: 32px;
        padding-right: 8px;
        width: auto;
      }

      .ant-form-item-control {
        height: 32px;
        line-height: 32px;
      }
    }
  }

  .table-page-search-submitButtons {
    display: block;
    margin-bottom: 24px;
    white-space: nowrap;
  }
}

.content {
  .table-operator {
    margin-bottom: 18px;

    button {
      margin-right: 8px;
    }
  }
}

.themeColorCustomColor {
  .ant-popover-inner-content {
    padding: 0;
  }
}

.flex_justify_left {
  display: flex;
  align-items: center;
  justify-content: left;

}

.flex_center {
  display: flex;
  align-items: center;
  justify-content: center;

}

.flex_space {
  display: flex;
  align-items: center;
  justify-content: space-between;

}

.flex_end {
  display: flex;
  align-items: center;
  justify-content: end;

}

.flex_direction_column {
  display: flex;
  flex-direction: column;
}

.flex_direction_column_center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;

}

.content_box {
  height: 100%;

  .top_box {
  }

  .bottom_box {
    flex: 1;
  }

}

.highlight {
  background-color: #ffc53d;
  padding: 0 2px;
  border-radius: 2px;
}

#html .ant-btn-primary:active, #html .ant-btn-primary:hover, #html .ant-btn-primary:focus {
  //color: #519BE0;
  background-color: #1677ff;
}

@color-primary: #1677ff;
